classdef TestParticipationCostDistribution < matlab.unittest.TestCase

    properties
        OriginalPath
        par
        part_dist
        part_dist_cal
    end
    
    methods (TestMethodSetup)
        function createFixture(testCase)
            testCase.OriginalPath = path;
            testCase.addTeardown(@path,testCase.OriginalPath);
            
            addpath('../');
            addpath('../../Densities/');

            testCase.par = table2struct(readtable(['../parameters/' ...
                                'distributions_par.csv']));
            testCase.part_dist = ParticipationCostDistribution(testCase.par);
            testCase.part_dist_cal = ParticipationNormal();
        end
    end
 
    methods (Test)
        
        function test_constructor(testCase)
            testCase.part_dist
        end

        
        function test_G_M(testCase)
            phi = 4.375633772000000e+03;
            actVal = testCase.part_dist.G_M(phi);
            expVal = testCase.part_dist_cal.G_M(phi,testCase.par);
            testCase.verifyEqual(actVal, expVal, 'AbsTol', 1e-6)
        end
        
        
        function test_G_R(testCase)
            phi = 4.375633772000000e+03;
            actVal = testCase.part_dist.G_R(phi);
            expVal = testCase.part_dist_cal.G_R(phi,testCase.par);
            testCase.verifyEqual(actVal, expVal, 'AbsTol', 1e-6)
        end        
        
        
        function test_G_C(testCase)
            phi = 4.375633772000000e+03;
            actVal = testCase.part_dist.G_C(phi);
            expVal = testCase.part_dist_cal.G_C(phi,testCase.par);
            testCase.verifyEqual(actVal, expVal, 'AbsTol', 1e-6)
        end
        
        
        function test_g_M(testCase)
            phi = 0;
            actVal = testCase.part_dist.g_M(phi);
            expVal = testCase.part_dist_cal.g_M(phi,testCase.par);
            testCase.verifyEqual(actVal, expVal, 'AbsTol', 1e-8)
        end     
        
        
        function test_g_R(testCase)
            phi = 0;
            actVal = testCase.part_dist.g_R(phi);
            expVal = testCase.part_dist_cal.g_R(phi,testCase.par);
            testCase.verifyEqual(actVal, expVal, 'AbsTol', 1e-8)
        end    
        
        
        function test_g_C(testCase)
            phi = 0;
            actVal = testCase.part_dist.g_C(phi);
            expVal = testCase.part_dist_cal.g_C(phi,testCase.par);
            testCase.verifyEqual(actVal, expVal, 'AbsTol', 1e-8)
        end               
    end

end
